@extends("public.father")

@section("content")


    <table class="table table-dark">
        <thead>
        <tr>
            <th scope="col">编号</th>
            <th scope="col">姓名</th>
            <th scope="col">邮箱</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>

        @foreach($users as $v)
        <tr>
            <th scope="row">{{$v["id"]}}</th>
            <td>{{$v["name"]}}</td>
            <td>{{$v["email"]}}</td>
            <td>
             <a style="float: left" href="{{route("user.show",["id"=>$v["id"]])}}" class="btn btn-dark">查看</a>

                @can("update",$v)
                <a style="float: left" href="{{route("user.edit",["id"=>$v["id"]])}}" class="btn ml-2 btn-primary">编辑</a>
                @endcan
                @can("delete",$v)
                        <form action="{{route("user.destroy",["id"=>$v["id"]])}}" method="post">
                            @csrf
                            @method("delete")

                            <button  type="submit"  class="btn btn-success ml-2 ">删除</button>

                        </form>

                    @endcan
            </td>


            {{--@can('update',$v)--}}
                {{--<a href="{{route('user.edit',['id' => $v['id']])}}" class="btn btn-success">编辑</a>--}}
            {{--@endcan--}}
            {{--@can('delete',$v)--}}
                {{--<button type="button" class="btn btn-danger">删除</button>--}}
                {{--@endca--}}

        </tr>
            @endforeach
        </tbody>
    </table>

    {{ $users->links() }}

    @endsection
